﻿#region File and License Information
/*
<File>
	<License>
		Copyright © 2009 - 2017, Daniel Vaughan. All rights reserved.
		This file is part of Calcium (http://calciumsdk.net), 
		which is released under the MIT License.
		See file /Documentation/License.txt for details.
	</License>
	<CreationDate>2010-11-15 10:45:32Z</CreationDate>
</File>
*/
#endregion

using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows;

namespace Outcoder.Reflection
{
	/// <summary>
	/// This class provides utility methods to retrieve information 
	/// about the application environment.
	/// </summary>
	public class RuntimeContext
	{
		/// <summary>
		/// Retrieves the list of user <c>Types</c> available within an application.
		/// </summary>
		/// <returns>The list of Types.</returns>
		public static IEnumerable<Type> GetNonBclTypes()
		{
			List<Type> typeList = new List<Type>();
			foreach (var part in Deployment.Current.Parts)
			{
				string assemblyName = part.Source.Replace(".dll", string.Empty);
				Assembly assembly = Assembly.Load(assemblyName);
				Type[] types = assembly.GetTypes();
				
				typeList.AddRange(types);
			}
			return typeList;
		}
	}
}
